#pragma once

#define MYRULEDLGXMLNAME _T("rule_dlg.xml")
class BaseDialog;
class CRuleDlg : public CWindowWnd, public INotifyUI
{
public:
	CRuleDlg(BaseDialog *pDlg);
	virtual ~CRuleDlg();
protected:
	virtual LPCTSTR GetWindowClassName() const { return _T("mogu Rule Dialog"); }

	virtual void Notify(TNotifyUI& msg);
	virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);

	// custom message map
	typedef HRESULT(CRuleDlg::*CustomMsgHandler)(WPARAM, LPARAM, BOOL&);
	typedef std::map<UINT, CustomMsgHandler> MessageMap;
	virtual MessageMap* InitMessageMap();

	// custom message handler
	HRESULT OnCreate(WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	HRESULT OnNcHitTest(WPARAM wParam, LPARAM lParam, BOOL& bHandled);
private:
	CPaintManagerUI m_pm;
	
private:
	static unsigned int __stdcall RunAddProcesssLastItem(void *lpParam);
	static unsigned int __stdcall RunAddFileLastItem(void *lpParam);
	static unsigned int __stdcall RunAddNetLastItem(void *lpParam);
public:
	void AddProcesssLastItem();
	void DelProcesssCurItem();
	void AddFileLastItem();
	void DelFileCurItem();
	void AddNetLastItem();
	void DelNetCurItem();

public:
	BaseDialog *m_pMainDlg;
	CControlUI *m_pCombo_list;
	CControlUI *m_pEdit_product_name;
	CControlUI *m_pEdit_file_name;
	CControlUI *m_pEdit_net_process_name;
	CListUI *m_pListview_process;
	CListUI *m_pListview_file;
	CListUI *m_pListview_net;
	int m_iLastIndex_process;
	int m_iLastIndex_file;
	int m_iLastIndex_net;
};

